package com.woniuxy.controller;

import com.woniuxy.entity.ExamPublishexam;
import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.service.ExamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author wenlei
 * @ClassName ExamController
 * @Description 考试
 * @date 2022/5/4 15:51
 **/

@Api(tags="考试管理")
@RestController
@RequestMapping("/exam")
public class ExamController {
    @Autowired
    ExamService examService;

    @ApiOperation("增加考试")
    @PostMapping("addExam")
    public ResponseEntity addExam(@RequestBody ExamPublishexam examPublishexam){
        return examService.addExam(examPublishexam);
    }

    @ApiOperation("条件查询考试列表")
    @PostMapping("find/{currentPage}/{pageSize}")
    public ResponseEntity find(@RequestBody ExamPublishexam examPublishexam,@PathVariable int currentPage,@PathVariable int pageSize){
        return examService.find(examPublishexam,currentPage,pageSize);
    }

    @ApiOperation("查询全部考试列表")
    @GetMapping("findAll/{currentPage}/{pageSize}")
    public ResponseEntity findAll(@PathVariable int currentPage,@PathVariable int pageSize){
        return examService.findAll(currentPage,pageSize);
    }


    @ApiOperation("删除考试")
    @PutMapping("deleteExam/{id}")
    public ResponseEntity deleteExam(@PathVariable int id){
        return examService.deleteExam(id);
    }

    @ApiOperation("批量删除考试")
    @PutMapping("deleteMore")
    public ResponseEntity deleteExam(@RequestBody ExamPublishexam examPublishexam){
        return examService.deleteExamMore(examPublishexam);
    }

    @ApiOperation("查询全部考生信息")
    @GetMapping("findAllExamineeInfo")
    public ResponseEntity findAllExamimeeInfo(){
        return examService.findAllExamineeInfo();
    }

    @ApiOperation("根据id查询需要参加考试的考生信息")
    @GetMapping("findExamineeByEid/{id}")
    public ResponseEntity findExamineeByEid(@PathVariable int id){
        return examService.findExamineeByEid(id);
    }

    @ApiOperation("删除参加考试的考生")
    @PutMapping("deleteExamJoinInfo")
    public ResponseEntity deleteExamJoinInfo(@RequestBody ExamPublishexam examPublishexam){
        return examService.deleteExamJoinInfoById(examPublishexam);
    }

    @ApiOperation("修改考试")
    @PutMapping("deleteExam")
    public ResponseEntity updateExam(@RequestBody ExamPublishexam examPublishexam){
        return examService.updateExam(examPublishexam);
    }

    @ApiOperation("查询试卷信息")
    @GetMapping("findPaperAtt")
    public ResponseEntity findPaperAtt(){
        return examService.findPaperAtt();
    }

}
